import { Component, OnInit , Output,Input,EventEmitter,ViewChild,ElementRef,DoCheck} from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
// declare var $: any;
import * as $ from 'jquery';
@Component({
  selector: 'app-mask-reason',
  templateUrl: './mask-reason.component.html',
  styleUrls: ['./mask-reason.component.scss']
})
export class MaskReasonComponent implements OnInit {
 private isShowTip:boolean = false;
  constructor() { }
  ngOnInit() {
    console.log(this.Audit)
  }
  ngAfterViewInit () {
    
  };
  ngDoCheck(){
    console.log(this.Audit.DismissReason)
  }
@Input() Audit;
  @ViewChild('DismissReason')
  DismissReason: ElementRef;
  @Output()
  public maskCancel = new EventEmitter<object>();
  public maskCancelSure(event):void{
    // if (event) {
    let eventCont = event.target.innerText;
    if (eventCont ==='确定') {
      if (this.Audit.DismissReason !=='' && this.Audit.DismissReason !=='请填写驳回原因。。。'){
        this.maskCancel.emit(event);           
      } else {
       this.Audit.DismissReason="驳回原因不能为空";
       this.isShowTip = true; 
       let _this = this;
       $('#DismissReason').focus(function () {
        _this.isShowTip = false; 
       })
      } 
    }  else {
      this.maskCancel.emit(event);
    }
  // }
  
  }
}
